﻿package mortal.game.view.common.display
{
    import com.mui.controls.*;
    import com.mui.display.*;
    import com.mui.manager.*;
    import flash.text.*;
    import mortal.common.*;
    import mortal.game.view.common.*;

    public class TextBox extends ToolTipSprite
    {
        public var _text:GTextFiled;
        private var _bg:ScaleBitmap;
        private var _label:String;
        private var _htmlText:String;
        private var _bgWidth:Number = 23;
        private var _bgHeight:Number = 117;
        private var _textFieldWidth:Number = 100;
        private var _textFieldHeight:Number;

        public function TextBox()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._bg = UIFactory.bg(0, 0, this._bgWidth, this._bgHeight, this, "InputDisablBg");
            this._bg.width = this._bgWidth;
            this._bg.height = this._bgHeight;
            this._text = UIFactory.gTextField("", 0, 0, this._textFieldWidth, this._textFieldHeight, this, null, true);
            if (this._label)
            {
                this._text.text = this._label;
            }
            if (this._htmlText)
            {
                this._text.htmlText = this._htmlText;
            }
            if (this._textFieldWidth)
            {
                this._text.width = this._textFieldWidth;
            }
            if (this._bgWidth)
            {
                this._bg.width = this._bgWidth;
                this._text.width = this._bgWidth;
            }
            if (this._bgHeight)
            {
                this._bg.height = this._bgHeight;
                this._text.height = this._bgHeight;
            }
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._bg.dispose();
            this._text.dispose();
            this._bg = null;
            this._text = null;
            super.disposeImpl(param1);
            return;
        }// end function

        override public function dispose(param1:Boolean = true) : void
        {
            this._label = "";
            this._htmlText = "";
            this._bgWidth = 0;
            this._bgHeight = 0;
            this._textFieldWidth = 100;
            this._textFieldHeight = 20;
            super.dispose(param1);
            return;
        }// end function

        public function get textField() : TextField
        {
            return this._text;
        }// end function

        public function set label(param1:String) : void
        {
            this._label = param1;
            this._text.text = param1;
            return;
        }// end function

        public function get label() : String
        {
            return this._label;
        }// end function

        public function set htmlText(param1:String) : void
        {
            this._htmlText = param1;
            this._text.htmlText = param1;
            return;
        }// end function

        public function get htmlText() : String
        {
            return this._htmlText;
        }// end function

        public function set textFieldWidth(param1:Number) : void
        {
            this._textFieldWidth = param1;
            this._text.width = param1;
            return;
        }// end function

        public function set textFieldHeight(param1:Number) : void
        {
            this._textFieldHeight = param1;
            this._text.height = param1;
            return;
        }// end function

        public function set bgWidth(param1:Number) : void
        {
            this._bgWidth = param1;
            this._bg.width = param1;
            this._text.width = param1;
            return;
        }// end function

        public function get bgWidth() : Number
        {
            return this._bg.width;
        }// end function

        public function set bgHeight(param1:Number) : void
        {
            this._bgHeight = param1;
            this._bg.height = param1;
            this._text.height = param1;
            return;
        }// end function

        public function get bgHeight() : Number
        {
            return this._bg.height;
        }// end function

        public function set defaultTextFormat(param1:TextFormat) : void
        {
            this._text.defaultTextFormat = param1;
            return;
        }// end function

        public function setbgStlye(param1:String, param2:GTextFormat) : void
        {
            this._bg.dispose(true);
            this._bg = UIFactory.bg(0, 0, this._bgWidth, this._bgHeight, this, param1);
            setChildIndex(this._bg, 0);
            this._text.defaultTextFormat = param2;
            this._text.setTextFormat(param2);
            return;
        }// end function

    }
}
